﻿/**	ali.h
 *	----	Create Time Stamp	--2007-02-04 18:03:19--
 *------------------------------------------------------------------------------
 *	Mean	:解析器
 *	Author	:Nick Shallery	(nicknide@gmail.com)
 *	Version	:1.0.10.18	(2009-09-08 00:38:59)
 *------------------------------------------------------------------------------
**/	/*YOU HAVE ALL LEFT WITH THIS CODE WHILE YOU KEEP COMMENT IN EVERY COPY.*/


#if			!defined(__LXUT__ALICE__ALI_H__K_IN_G__)
#define		__LXUT__ALICE__ALI_H__K_IN_G__
//==============================================================================
//--------------------------------------------------------------------------

#if			!defined(__LOLIX__LOLI_X_MACRO__K_IN_G__)
	#include	"../../lolix/lolix_macro.h"
#endif	//	!defined(__LOLIX__LOLI_X_MACRO__K_IN_G__)

#if			!defined(__LOLIX__LOLIX_TYPE__K_IN_G__)
	#include	"../../lolix/lolix_type.h"
#endif	//	!defined(__LOLIX__LOLIX_TYPE__K_IN_G__)

#if			!defined(__LOLIX__TOY__REBIND_TYPE__K_IN_G__)
	#include	"../../lolix/toy/rebind_type.hpp"
#endif	//	!defined(__LOLIX__TOY__REBIND_TYPE__K_IN_G__)


namespace lxut{	namespace alice{

class LOLIX_NO_VTABLE ali_target
	: public lolix::itf
{
public:
	LOLIX_DECLARE_ITF(lxut::alice::ali_target, lolix::itf, (0x4aa587e2, 0x13d34fee, 0x822c3666, 0x4769143e));
	LOLIX_INTERFACE(lock	, const char*	, (void)const);
	LOLIX_INTERFACE(size	, size_type		, (void)const);
	LOLIX_INTERFACE(write	, size_type		, (const char* bg, const char* ed));
	LOLIX_INTERFACE(clear	, void			, (void));
	LOLIX_INTERFACE(unlock	, void			, (const void*));
};


class ali_base;
class LOLIX_NO_VTABLE  ali_factory
	: public lolix::itf
{
public:
	LOLIX_DEFINE_ITF_ID(0x12c47cbc, 0x0d3147cf, 0x8a20f2a3, 0x3d877b16);
	enum ALI_OBJ_TYPE;
	virtual lolix::LOLIX_RETNV create_inst(ali_base**, ALI_OBJ_TYPE type)	= 0;
	virtual lolix::LOLIX_RETNV create_ali_target(ali_target**)				= 0;
};


class LOLIX_NO_VTABLE  ali_base
	: public lolix::itf
{
public:
	typedef	ali_factory					factory_type;
	LOLIX_DEFINE_ITF_ID(0x5bebb212, 0xbc7f45a6, 0xba660096, 0x5b54127b);
	virtual factory_type::ALI_OBJ_TYPE	get_type(void)const			= 0;
	virtual lolix::LOLIX_RETNV			clone(ali_base**)const		= 0;
	virtual lolix::LOLIX_RETNV			set_target(ali_target*)		= 0;
	virtual ali_target*					get_target(void)			= 0;
	virtual const char*					try_look(const char* bg, const char* ed)= 0;
};


enum lxut::alice::ali_factory::ALI_OBJ_TYPE
{
	//	$<str(=num)>
	ALI_OBJ_TYPE_FULL			,	//	支持带格式的匹配
	ALI_OBJ_TYPE_LINE			,	//	一行
	ALI_OBJ_TYPE_WHITE_SPACE	,	//	空白+注释符号				"$<white>"
	ALI_OBJ_TYPE_BACKSLASH		,	//	解析以反斜杠表达的多行合并
		ALI_OBJ_TYPE_BLANK		,	//	空白符号					"$<blank>"
		ALI_OBJ_TYPE_COMMENT	,	//	注释						"$<comment>"

	ALI_OBJ_TYPE_IDENTIFIER		,	//	匹配标示符					"$<identifier>"

	ALI_OBJ_TYPE_LITERALS		,	//	值							"$<literal>"
		ALI_OBJ_TYPE_LNTEGER	,	//	整数						"$<int>"
		ALI_OBJ_TYPE_FLOATING	,	//	浮点数						"$<float>"
		ALI_OBJ_TYPE_STRING		,	//	字符串						"$<str>"
		ALI_OBJ_TYPE_CHARACTER	,	//	字符						"$<chr>"

	ALI_OBJ_TYPE_NULL			,	//	结束						"$<null>"
};
}}


SYS_REGIST_TYPE(lxut::alice::ali_base);
SYS_REGIST_TYPE(lxut::alice::ali_factory);
SYS_REGIST_TYPE(lxut::alice::ali_target);

//lolix::LOLIX_RETNV LxutCreateAliFactor(lxut::alice::ali_factory**, lolix::lolix_inst* lx_inst);


//--------------------------------------------------------------------------
//==============================================================================
#endif	//	!defined(__LXUT__ALICE__ALI_H__K_IN_G__)
